{% extends "base.html" %}
{% block title %}领导活动{% endblock %}
{% block content %}

{% if persons %}
    <p>{% if not request.user.is_authenticated %}
        请登录，或者在请求中加入user参数
        <a class="btn btn-primary" href="/login">登录</a>
        {%endif%}
    </p>
    <table class="table">
        <thead><tr><td>区域</td><td>名称</td><td>职位</td><td>职责</td><td>城市</td>
            <td>新闻词频(有权限)</td>
            <td>新闻</td></tr></thead>
        <tbody>
         {% for item in persons %}
        <tr>
            <td>{{ item.category }}</td><td>{{ item.name }}</td><td>{{item.position}}</td><td>{{item.duty}}</td>
            <td>{{ item.city }}</td>
            <td>
                {% if request.user.is_authenticated %}
                <a href="/leader_keyword?num=15&personid={{ item.personId }}&user={{ request.user.username }}" target="_blank">
                    {{ item.personId }}</a>
                {% else %}
                <a href="/leader_keyword?num=15&personid={{ item.personId }}" target="_blank">
                    {{ item.personId }}</a>
                {% endif %}

            </td>
            <td>
                <a href="/leader_news?personid={{ item.personId }}&name={{ item.name }}" target="_blank">{{ item.personId }}</a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
{% endif %}

{% endblock%}